/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.org.mtgatherer.entities;

import com.google.appengine.api.datastore.Key;
import java.util.LinkedList;
import java.util.List;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 *
 * @author esed
 */
@PersistenceCapable 
public class Deck
{
   @PrimaryKey
   @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
   private Key id;
   
   @Persistent
   private List<DeckCard> deckCardList = new LinkedList<DeckCard>();

   public List<DeckCard> getDeckList()
   {
      return deckCardList;
   }

   public void setDeck(List<DeckCard> deckCardList)
   {
      this.deckCardList = deckCardList;
   }
   
   @Override
   public String toString()
   {
      String deckString = "";
      
      for (DeckCard deckCard : deckCardList)
      {
         if (deckCard.getCardPlace() == CardPlace.MAINDECK) deckString+=deckCard;
      }
      
      deckString+="SideBoard\n";
      
      for (DeckCard deckCard : deckCardList)
      {
         if (deckCard.getCardPlace() == CardPlace.SIDEBOARD) deckString+=deckCard;
      }
      
      return deckString;
   }
}
